Title: SQL BT (By-BKK) / 01 Select
Tags: Obsidian_to_Anki

Q: What SQL statement is used to get data from a database?
A: SELECT * or SELECT column_1

Q: True or False: A query only declares what data we are looking for.
A: False. It also says where to find it and how to transform it (Conditions such as WHERE, GROUP BY, HAVING, SORT BY).

Q: What does each row in a SQL table represent?
A: A specific instance of an entity in the database

Q: What do columns in a SQL table represent?
A: Properties shared by all instances (Such as column name, column type, constrains)

Q: How do you select specific columns from a table in SQL?
A: SELECT column, another_column FROM mytable;

Q: How do you select all columns from a table?
A: SELECT * FROM mytable;

Q: True or False: SELECT * FROM mytable; retrieves all columns and rows from the table
A: True

Q: What is the result of a SELECT query?
A: A two-dimensional set of rows and columns, containing data points or entities.

Q: Name three columns in the Movies table.
A: Title, Director, Year

Q: What SQL query finds only the title of each film?
A: SELECT title FROM movies;

Q: How do you find director of each film using SQL?
A: SELECT director FROM movies;

Q: How do you get both the title and director of each film?
A: SELECT title, director FROM movies;

Q: What query gives the title and year of each film?
A: SELECT title, year FROM movies;

Q: True or False: You must always list all columns in a SELECT statement
A: False. Use * for all columns, else Use selected columns that are required

Q: Reverse card: SELECT column, another_column FROM mytable; (Hint: view specific columns)
A: How do you select specific columns from a table in SQL?

Q: Reverse card: A specific instance of an entity (hint: each row in SQL)
A: What does each row in a SQL table represent?

Q: Reverse card: SELECT title, year FROM movies;
A: What SQL query finds the title and year of each film?

Q: What is a query in SQL?
A: A statement declaring what data to retrieve, where to find it, and how to transform it

Q: How do you select all columns from a SQL table?
A: SELECT * FROM mytable;

Q: How do you select specific columns from a table?
A: SELECT column, another_column FROM mytable;

Q: What do columns represent in SQL tables?
A: Common properties of all instances

Q: What does SELECT * FROM mytable; do?
A: Retrieves all columns and rows from the table

Q: Which table is used in this lesson’s exercises? (hint: Movies)
A: Movies

Q: Which columns are in the Movies table?
A: Id, Title, Director, Year, Length_minutes

Q: What is the SQL query to find titles of all films?
A: SELECT title FROM movies;

Q: How do you get directors of all films?
A: SELECT director FROM movies;

Q: What is the SQL to get both title and director of each film?
A: SELECT title, director FROM movies;

Q: How do you find title and year of each film?
A: SELECT title, year FROM movies;

Q: True or False: The asterisk * in SELECT can replace listing all column names
A: True

Q: Reverse card: SELECT * FROM mytable;
A: Which SQL query gets all columns from a table?

Q: Reverse card: Title, Director, Year (hint: in Movies Table)
A: Name three columns in the Movies table

Q: Reverse card: SELECT title FROM movies;
A: What is the SQL query to find the title of each film?

Q: Reverse card: Common properties of all instances
A: What do columns represent in a SQL table?

Q: What does each row in a SQL table represent?
A: A specific instance of the entity

Q: Which table is used for the exercises in this lesson? (hint: Movies)
A: Movies

Q: Reverse card: Properties shared by all instances (hint: columns in SQL represent)
A: What do columns in a SQL table represent?